home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / zvt1_11u.lha / ZVT / ExampleScripts / FaxScript.rexx < prev    next >
OS/2 REXX Batch file  |  1995-09-05  |  2KB  |  105 lines

  1. /* FaxScript For GPFax And ZVT                    */
  2. /* Start/Listen GPFax, Recieve Fax, Exit/Unlisten GPFax        */
  3.  
  4. options results
  5.  
  6. signal on break_c
  7. signal on halt
  8. signal on syntax
  9.  
  10. options failat 50
  11.  
  12. say "FaxScript For GPFax And ZVT"
  13.  
  14. /*
  15.  * Check if GPFax is already there
  16.  */
  17.  
  18. ADDRESS COMMAND "WFP REXX_GPFAX 0"
  19.  
  20. if rc>0 then
  21.     do
  22.         /*
  23.          * No GPFax here. Start and wait for it.
  24.          */
  25.  
  26.         ADDRESS COMMAND "run >nil: <nil: GPFax:GPFax -z -W -NP -Q"
  27.         ADDRESS COMMAND "WFP REXX_GPFAX 30"
  28.         if rc>0 then
  29.         do
  30.             /*
  31.              * GPFax didn't come up for a reason.
  32.              */
  33.  
  34.             call setVars(rc)
  35.             exit
  36.         end
  37.  
  38.         /*
  39.          * Start fax handshaking and receive fax, then
  40.          * shut down GPFax
  41.          */ 
  42.  
  43.         ADDRESS rexx_gpfax recfax
  44.         call setVars(rc)
  45.         ADDRESS rexx_gpfax quitfax
  46.     end
  47. else
  48.     do
  49.         /*
  50.          * Wake up GPFax, start fax handshaking and receive fax,
  51.          * then put GPFax to sleep mode again.
  52.          */
  53.  
  54.         ADDRESS rexx_gpfax openserial
  55.         ADDRESS rexx_gpfax recfax
  56.         call setVars(rc)
  57.         ADDRESS rexx_gpfax closeserial
  58.     end
  59. exit
  60.  
  61. /*
  62.  * Set ZVT logfile entry according to GPFax' status report
  63.  */
  64.  
  65. setVars: procedure
  66.     parse arg error
  67.  
  68.     if error=0 then
  69.         do
  70.         address rexx_gpfax 'reportlog' 6
  71.         address zvt.1 'setlength ' || result
  72.         address rexx_gpfax 'reportlog' 1
  73.         address zvt.1 'setname ' || result
  74.         end
  75.     else        /* No fax here. */
  76.         do
  77.         address rexx_gpfax 'reportlog' 6
  78.         address zvt.1 'setlength ' || 0
  79.         address zvt.1 'setname no_file'
  80.         end
  81.     return rc
  82.  
  83.  
  84. error:
  85.     call Debug("Error" rc "at line" sigl)
  86.     return rc
  87.  
  88. break_c:
  89. halt:
  90.     call Debug("CTRL_C at line" sigl)
  91.     exit 20
  92.  
  93. syntax:
  94.     call Debug("Syntax error" rc "at line" sigl)
  95.     return rc
  96.  
  97.  
  98. Debug: procedure
  99.     parse arg info
  100.  
  101.     firstLine = sourceline(1)
  102.     parse var firstLine '/*' title '*/'
  103.     say title ':' info
  104.     return
  105.